package com.smartcar.driver.feign;

import com.alibaba.fastjson.JSONObject;
import com.smartcar.common.domain.User;
import com.smartcar.common.domain.request.FindUserVo;
import com.smartcar.common.domain.request.OrderRequest;
import com.smartcar.common.result.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Log4j2
@Component
public class OrderFeignServiceTemLate {

    public static final Integer SUCCESS_CODE = 200;

    @Autowired
    private OrderFeign orderFeign;

    //TODO 司机添加订单信息
    public int insertOrderByDriver(OrderRequest orderRequest) throws Exception {
        log.info("调用外部接口开始，方法名：司机添加订单信息，入参是：{}", JSONObject.toJSONString(orderRequest));
        Result<Integer> result = orderFeign.updateOrderByDriver(orderRequest);
        log.info("调用外部接口结束，方法名：司机添加订单信息，出参是：{}", JSONObject.toJSONString(result));
        if (!SUCCESS_CODE.equals(result.getCode())) {
            log.info("调用外部接口失败，方法名：司机添加订单信息，报错信息是：{}", result.getMsg());
        }
        return result.getData();
    }
}
